/*
 * @Author: niuxb 951259738@qq.com
 * @Date: 2022-06-24 10:27:52
 * @LastEditors: niuxb 951259738@qq.com
 * @LastEditTime: 2022-06-30 10:49:54
 * @FilePath: /syq/src/assets/js/moaBridge_ha_djfupt.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

/*
员工论坛

moaBridge.closeDoc('djfupt')

*/



var moaBridge_ha_djfupt = {

     closeDoc: function(params){
        if(is_android()){
            window.jsBridge.closeDoc(JSON.stringify(params));
        }else if(is_iphone() || is_iPad()){
            window.webkit.messageHandlers.closeDoc.postMessage(params);
        }
    },
    refreshMOA:function(){
        console.log("refreshMOA");
     if(is_android()){
        console.log("android-refresh");
         window.jsBridge.refreshMOA();
     }else if(is_iphone() || is_iPad()){
        console.log("ios-refresh");
         window.webkit.messageHandlers.refreshMOA.postMessage(null);
     }
    },
    getQRCode:function(){
      if(is_android()){
        window.jsBridge.getQRCode("11111","22222");
     }else if(is_iphone() || is_iPad()){
        window.webkit.messageHandlers.getQRCode.postMessage(null);
     }
    }
  	
}


var ua = navigator.userAgent.toLowerCase();
//判断环境
function is_android(){
    if(ua.match(/android/i)=="android"&&ua.match(/iemobile/i)!="iemobile"){
         return true;
    } else {
         return false;
    }
}
function is_iphone(){
    if(ua.match(/iphone/i)=="iphone"&&ua.match(/iemobile/i)!="iemobile"){
         return true;
    } else {
         return false;
    }
}
function is_iPad(){
  if(ua.match(/iPad/i)=="iPad"||ua.match(/ipad/i)=="ipad"){
       return true;
  } else {
       return false;
  }
}


export default moaBridge_ha_djfupt




